<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
		<title>惠友多</title>
		<link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
		<!-- 引入在线资源 -->
		<script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-6.0.0.min.js"></script>
		<script src="http://webapi.amap.com/maps?v=1.4.3&key=b698e8fc43715a16053e9fa156601706"></script>
	</head>
	<style>
		body,html {
				-webkit-overflow-scrolling: touch;
		}
		#home-container{
			height: 100%;
      overflow-y: scroll;
		}
		.weui-icon_toast.weui-loading {
				margin: 15px 0 0;
				width: 38px;
				height: 38px;
				vertical-align: baseline;
		}
	</style>
  <body>
    <div id="root"></div>

    <script src="js/mui.min.js"></script>
	<script>
			// var positionAddress = '北京市 北京城区 东城区';
			// localStorage.setItem('addressNow', positionAddress);
		
		window.alert = function(name){
			 var iframe = document.createElement("IFRAME");
			iframe.style.display="none";
			iframe.setAttribute("src", 'data:text/plain,');
			document.documentElement.appendChild(iframe);
			window.frames[0].window.alert(name);
			iframe.parentNode.removeChild(iframe);
		}

		  mui.init({
		    swipeBack: false, //关闭右滑关闭功能（默认就是false）
		    keyEventBind: {
		      backbutton: true //开启back按键监听（默认就是true）
		    }
		  });
		  var quitTime = null;
			var shares = null;
			var TEST_NAME = "huiyouduo";
			// window["TEST_NAME"] = TEST_NAME;
			window.testName = "testname 2";
		  mui.plusReady(function(){
			// 更新分享服务
			updateSerivces();
			// var currentLon,currentLat,map;
			// plus.geolocation.getCurrentPosition(translatePoint,function(e){	mui.toast("异常:" + e.message);})
			// function translatePoint(position){
			// 	// positionAddress = position.address.province + ' ' +position.address.city + ' ' +position.address.district;
			// 	// localStorage.setItem('addressNow', positionAddress);
			// }
			// 个推监听点击消息事件
			plus.push.addEventListener( "click", function( msg ) {
					//mui.alert(plus.push.getClientInfo().clientid)
					//跳转到对应页面
					location.hash = msg.payload.payload;
			}, false );
		    mui.back = function(){
		      //首次按键，提示‘再按一次退出应用’
		      if (!quitTime) {
		        //记录第一次按下回退键的时间
		        quitTime = new Date().getTime();
		        //回退到上一页面
		        window.history.go(-1);
		        setTimeout(function() {
		          //1s中后清除
		          quitTime = null;
		        }, 1000);
		      }else{
		        if((new Date().getTime() - quitTime) < 1000){
		          quitTime = null;
		          plus.runtime.quit();
		        }
		      }
		    };
		  });
					/**
			 * 更新分享服务
			 */
			 function updateSerivces() {
					plus.share.getServices(function(s) {
							shares = {};
							for (var i in s) {
									var t = s[i];
									shares[t.id] = t;
							}
							console.log("获取分享服务列表成功");
					}, function(e) {
							console.log("获取分享服务列表失败：" + e.message);
					});
			}
		</script>
  </body>
</html>
